<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>收派时间管理</title>
    <!-- 导入jquery核心类库 -->
    <script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
    <!-- 导入easyui类库 -->
    <link rel="stylesheet" type="text/css" href="../../js/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../js/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../../js/easyui/ext/portal.css">
    <link rel="stylesheet" type="text/css" href="../../css/default.css">
    <script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../js/easyui/ext/jquery.portal.js"></script>
    <script type="text/javascript" src="../../js/easyui/ext/jquery.cookie.js"></script>
    <script src="../../js/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            // 先将body隐藏，再显示，不会出现页面刷新效果
            $("body").css({visibility: "visible"});


            // 收派时间管理信息表格
            $('#grid').datagrid({
                iconCls: 'icon-forward',
                fit: true,
                border: false,
                rownumbers: true,
                striped: true,
                pageList: [10, 20, 30],
                pagination: true,
                toolbar: toolbar,
                url: "../../taketime_pageQuery.action",
                idField: 'id',
                columns: columns
            });

            $('#save').click(function () {
                var form = $('#takeTimeForm').form('validate');
                if (form) {
                    $('#takeTimeForm').submit()
                } else {
                    $.messager.alert('警告!', '请完善信息!', 'warning')
                }
            })
        });

        //工具栏
        var toolbar = [{
            id: 'button-add',
            text: '增加',
            iconCls: 'icon-add',
            handler: function () {
                $('#addWindow').window("open")
            }
        }, {
            id: 'button-edit',
            text: '修改',
            iconCls: 'icon-edit',
            handler: function () {
                var selections = $('#grid').datagrid('getSelections')
                if (selections.length != 1) {
                    $.messager.alert('提示信息', '请选中或选择一行', 'warning')
                } else {
                    $('#takeTimeForm').form('load', selections[0])
                    $('#addWindow').window('open')
                }
            }
        }, {
            id: 'button-delete',
            text: '删除',
            iconCls: 'icon-cancel',
            handler: function () {
                var selections = $('#grid').datagrid('getSelections')
                var takeTimeIds=[];
                if (selections.length <= 0) {
                    $.messager.alert('提示信息', '请选中或选择一行', 'warning')
                } else {

                    for (var i = 0; i < selections.length; i++) {
                        takeTimeIds.push(selections[i].id)
                    }
                    takeTimeIds.join(",")
                    $.messager.confirm('警告','确定删除?',function (data) {
                        if (data) {
                            $.get('../../takeTime_delete.action?takeTimeids='+takeTimeIds,function (data) {
                                if (data) {
                                    location.reload()
                                }else{
                                    $.messager.alert('提示信息', '网络延迟,请重试', 'warning')
                                }
                            })
                        }
                    })
                }

            }
        }];

        // 定义列
        var columns = [[{
            field: 'id',
            checkbox: true,
        }, {
            field: 'name',
            title: '时间名称',
            width: 120,
            align: 'center'
        }, {
            field: 'normalWorkTime',
            title: '平时上班时间',
            width: 120,
            align: 'center'
        }, {
            field: 'normalDutyTime',
            title: '平时休息时间',
            width: 120,
            align: 'center'
        }, {
            field: 'satWorkTime',
            title: '周六上班时间',
            width: 120,
            align: 'center'
        }, {
            field: 'satDutyTime',
            title: '周六休息时间',
            width: 120,
            align: 'center'
        }, {
            field: 'sunWorkTime',
            title: '周日上班时间',
            width: 120,
            align: 'center'
        }, {
            field: 'sunDutyTime',
            title: '周日休息时间',
            width: 120,
            align: 'center'
        }, {
            field: 'status',
            title: '状态',
            width: 120,
            align: 'center'
        }, {
            field: 'company',
            title: '所属单位',
            width: 120,
            align: 'center'
        }, {
            field: 'operator',
            title: '操作人',
            width: 120,
            align: 'center'
        }, {
            field: 'operatingTime',
            title: '操作时间',
            width: 120,
            align: 'center'
        }, {
            field: 'operatingCompany',
            title: '操作单位',
            width: 120,
            align: 'center'
        }]];
    </script>
</head>
<body class="easyui-layout" style="visibility:hidden;">
<div region="center" border="false">
    <table id="grid"></table>
</div>
<center><p id="progressbar"></p></center>
<div class="easyui-window" closed="true" title="区域添加修改" id="addWindow" collapsible="false" minimizable="false"
     maximizable="false" style="top:30px;left:500px;width: 500px;height: 550px
">
    <div region="north" style="height:31px;overflow:hidden;" split="false" border="false">
        <div class="datagrid-toolbar">
            <a id="save" icon="icon-save" href="#" class="easyui-linkbutton" plain="true">保存</a>
        </div>
    </div>

    <div region="center" style="overflow:auto;padding:5px;" border="false">
        <form id="takeTimeForm" action="../../takeTimeSaveOrUpdate.action" method="post">
            <table class="table-edit" width="80%" align="center">
                <tr class="title">
                    <td colspan="2">区域信息</td>
                </tr>
                <tr>
                    <td>收派时间名称</td>
                    <td>
                        <input type="text" name="id" hidden="hidden">
                        <input type="text" name="name" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>平常上班时间</td>
                    <td>
                        <input type="text" name="normalWorkTime" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>平常下班时间</td>
                    <td>
                        <input type="text" name="normalDutyTime" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>周六上班时间</td>
                    <td>
                        <input type="text" name="satWorkTime" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>周六下班时间</td>
                    <td>
                        <input type="text" name="satDutyTime" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>周日上班时间</td>
                    <td>
                        <input type="text" name="sunWorkTime" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>周日下班时间</td>
                    <td>
                        <input type="text" name="sunDutyTime" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td>
                        <input type="text" name="status" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>所属公司</td>
                    <td>
                        <input type="text" name="company" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>

                <tr>
                    <td>操作员</td>
                    <td>
                        <input type="text" name="operator" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
                <tr>
                    <td>操作单位</td>
                    <td>
                        <input type="text" name="operatingCompany" class="easyui-validatebox" required="true"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
</body>
</html>
